﻿using Max.PH6_2006A.LowCode.Domain;
using Max.PH6_2006A.LowCode.IService;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Max.PH6_2006A.LowCode.API.Controllers
{
    /// <summary>
    /// 角色接口
    /// </summary>
    [Route("rbac/role")]
    [ApiController]
    public class SystemRoleController : BaseCRUDController<SystemRole, SystemRole, SystemRole>
    {
        ISystemRoleService _service;
        public SystemRoleController(ISystemRoleService service) : base(service)
        {
            _service = service;
        }
        /// <summary>
        /// 为角色配置菜单
        /// </summary>
        /// <param name="roleMenus"></param>
        /// <returns></returns>
        [HttpPost("config")]
        public IActionResult RoleConfigMenu(List<SystemRoleMenu> roleMenus)
        {
            string sql = "insert into SystemRoleMenu(roleid,meunid) values(@RoleId,@MeunId)";
            _service.Execute(sql, roleMenus);

            return Ok(roleMenus);
        }

    }

}
